<?php
/**
 * 注意：本内容仅限于博也公司内部传阅,禁止外泄以及用于其他的商业目的
 * @author    hebidu<346551990@qq.com>
 * @copyright 2017 www.itboye.com Boye Inc. All rights reserved.
 * @link      http://www.itboye.com/
 * @license   http://www.opensource.org/licenses/mit-license.php MIT License
 * Revision History Version
 ********1.0.0********************
 * file created @ 2017-12-14 10:06
 *********************************
 ********1.0.1********************
 *
 *********************************
 */

namespace app\web\controller;


use think\Controller;
use think\Request;
use think\Response;

class Net extends Controller
{
    public function index()
    {
        $port = $_SERVER["SERVER_PORT"];
        if ($port != '8888') {
            header('Location:http://test.sunsunxiaoli.com:8888/web.php/net/index');
        }

        $ip = $this->request->ip(0, true);
        $this->assign('ip', $ip);
        return $this->fetch();
    }

    public function test()
    {
        $id = Request::instance()->param('id');
        $data = [];
        for ($i = 0; $i < 1000; $i++) {
            array_push($data, $i);
        }
        return Response::create(json_encode($data), 'json')->code(200);
    }
}